package com.senlingspace;

import org.dromara.x.file.storage.spring.EnableFileStorage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 启动程序
 *
 * @author senlingspace
 */
@EnableFileStorage
@EnableScheduling
@EnableTransactionManagement
@EnableAsync
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class SenlingSpaceApplication {

    public static void main(String[] args) {
        SpringApplication.run(SenlingSpaceApplication.class, args);
    }

    @EventListener
    public void handleApplicationReady(ApplicationReadyEvent event) {
        Environment env = event.getApplicationContext().getEnvironment();
        String port = env.getProperty("server.port", "8080");
        System.out.println("当前运行的端口: " + port);
        System.out.println("(♥◠‿◠)ﾉﾞ  森灵空间，后端启动成功   ლ(´ڡ`ლ)ﾞ  \n");
    }

}
